import 'package:event_bus/event_bus.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:workmate/models/api.dart';
import 'package:workmate/models/config.dart';
import 'package:workmate/provider/locale.dart';
import 'package:workmate/provider/theme.dart';
import 'package:workmate/routers/index.dart';
import 'package:workmate/utils/http.dart';
import 'package:workmate/widget/layer.dart';

class APP {
  // 全局navigatorKey句柄
  static late GlobalKey<NavigatorState> navigatorKey;
  // 事件句柄
  static late EventBus event;
  // 路由句柄
  static late Routers router;
  // 路由观察句柄
  static RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
  // Provider句柄
  static List<ChangeNotifierProvider> getProviders() {
    return [
      ChangeNotifierProvider<ThemeProvider>(
        create: (context) => ThemeProvider(),
      ),
      ChangeNotifierProvider<LocaleProvider>(
        create: (context) => LocaleProvider(),
      ),
    ];
  }

  // 请求api配置句柄
  static late ApiModel api;
  // 远程获取配置
  static late ConfigModel config;
  // 请求句柄
  static late HttpManager http;
  // 请求toast
  static late Layer layer;
}
